#include <iostream>
using namespace std;

//子类就是特殊的父类
class Parent
{
protected:
	const char* name;
public:
	Parent()
	{
		name = "Parent";
	}

	void print()
	{
		cout<<"Name: "<<name<<endl;
	}
};

class Child : public Parent
{
protected:
	int i;
public:
	Child(int i)
	{
		this->name = "Child";
		this->i = i;
	}
};

int main()
{
	Child Child(1000);
	//分别定义父类对象 父类指针 父类引用 child
	Parent parent = Child;
	Parent* pp = &Child;
	Parent& rp = Child;
	//打印结果全指向子类print
	parent.print();
	pp->print();
	rp.print();

	Parent *p = new Parent;
	p->print();

	return 0;
}